package com.xmy.cultivate.mapper;

import com.xmy.cultivate.entity.StudentGradeHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 学生所在班级与课程（分班表） Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2024-08-05
 */
public interface StudentGradeHistoryMapper extends BaseMapper<StudentGradeHistory> {

    @Select("select * from student_grade_history where year_part = ${yearPart} and quarter_num = ${quarterNum} and subjects_id = ${subjectsId} and student_id = ${studentId} and lesson_type = ${lessonType} ORDER BY id desc limit 1")
    public StudentGradeHistory selectStudentGradeHistoryMaxOneByStudent(@Param("yearPart") Integer yearPart,
                                                                        @Param("quarterNum") Integer quarterNum,
                                                                        @Param("subjectsId") Long subjectsId,
                                                                        @Param("studentId") Long studentId,
                                                                        @Param("lessonType") Integer lessonType);
}
